﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HZ.BidSystem.Model;

public partial class Company_GoodsList : System.Web.UI.Page ,IAccess
{
    protected void Page_Load(object sender, EventArgs e)
    {
        CurrentAccount.CheckSessionTimeOut(this);

        if (!IsPostBack)
        {
            Bind();
            HZ.BidSystem.BLL.BLL_Cache.SetOnlineModel(CurrentAccount.Account.AccountId.Value, new OnLineModel() { Active = "正在查看品规" });
        }
    }
    protected void pager1_PageChanging(object sender, HZ.Web.PageChaningEventArgs e)
    {
        Bind();
    }

    private void Bind()
    {
        int totalrecord;
        var bidprice = BLL_Factory.IBLL_Company.GetBidPrice(new HZ.BidSystem.Model.QBidPrice() { CompanyId_Tb = CurrentAccount.Account.AccountId, SortFields = "GoodsId", ProductName = txtProductName.Text.Trim(), MedicineModel = txtMedicineModel.Text.Trim(), Outlookc = txtOutlookc.Text.Trim(), CompanyName_Sc = txtCompanyName_sc.Text.Trim() }, pager1.CurrentPage, pager1.PageSize, out totalrecord);

        pager1.RecordCount = totalrecord;

        gv1.DataSource = bidprice;
        gv1.DataBind();
    }
    protected void btnQuery_Click(object sender, EventArgs e)
    {
        pager1.CurrentPage = 1;
        Bind();
    }
    #region IAccess Members

    IList<EnumAccess> IAccess.AccessList
    {
        get
        {
            var list = new List<EnumAccess>();
            list.Add(EnumAccess.Company);
            return list;
        }

    }

    #endregion

}
